<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>活动管理</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		.table td {
			vertical-align: middle;
		}
	</style>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#listForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/ivm/business/activity/list">活动列表</a></li>
		<shiro:hasPermission name="ivm:business:activity:edit"><li><a href="${ctx}/ivm/business/activity/form">滚屏添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="activity" action="${ctx}/ivm/business/activity/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>名称：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-small"/>
		<label>类型：</label>
		<form:select path="type" class="input-small">
			<form:option value="" label="请选择"/>
			<form:options items="${fns:getDictList('activity_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
		</form:select>
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${message}"/>
	<form id="listForm" method="post">
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th width="149">封面</th>
				<th>名称</th>
				<th>副标题</th>
				<th>活动时间</th>
				<th>状态</th>
				<shiro:hasPermission name="ivm:business:activity:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="activity">
			<tr>
				<td><a href="${ctx}/ivm/business/activity/form?id=${activity.id}"><img id="photo" src="${ctx}/download?filePath=${activity.logoUrl }" style="width:149px; height:84px;" /></a></td>
				<td><a href="${ctx}/ivm/business/activity/form?id=${activity.id}">${activity.name}</a></td>
				<td>${activity.assisTitle }</td>
				<td>${activity.timeStr }</td>
				<td style="color:${activity.status=='0'?'green':'red' }">${activity.status=='0'?'正常':'取消'}</td>
				<shiro:hasPermission name="ivm:business:activity:edit"><td>
    				<a href="${ctx}/ivm/business/activity/form?id=${activity.id}">修改</a>
					<a href="${ctx}/ivm/business/activity/delete?id=${activity.id}" onclick="return confirmx('确认要删除该活动吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	</form>
	<div class="pagination">${page}</div>
</body>
</html>
